package com.wn.mapper;

import com.wn.entity.Article;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ArticleMapper {
    @Select("select * from article where id=#{id}")
    Article findById(Integer id);

    @Select("select * from article")
    List<Article> findAll();

    @Insert("insert into article(userid,title,createtime,content) " +
            "values(#{userid},#{title},#{createtime},#{content})")
    void save(Article article);

    @Update("update article set userid=#{userid},title=#{title}," +
            "createtime=#{createtime},content=#{content} where id=#{id}")
    void update(Article article);

    @Delete("delete from article where id=#{id}")
    void delete(Integer id);

    void delBatch(@Param("ids") List<Integer> ids);
}
